﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework - CNR Framework Section
 * Version 2.10
 * 
 * CNR Authentication Required Event Arguments Class
 *      Provides an event arguments base class for CNR Authentication events where
 * the user or other source must be queried for credentials.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using Adaptive.Foundation;

namespace Adaptive.Foundation.Network.Cnr
{
    /// <summary>
    /// Provides an event arguments base class for CNR Authentication events where 
    /// the user or other source must be queried for credentials.
    /// </summary>
    /// <remarks>
    /// In cases where credentials may be missing or unknown, this event arguments class
    /// and related events allow the system to query for credentials while processing
    /// within an authentication session.
    /// </remarks>
    public class CnrAuthenticationRequiredEventArgs : CnrAuthenticationEventArgs
    {
        /*--------------------------------------------------------------------------------
         * Private Member Declarations
         *------------------------------------------------------------------------------*/
        #region Private Member Declarations
        /// <summary>
        /// User password or other similar authentication data.
        /// </summary>
        private string _password;
        /// <summary>
        /// User identity value.
        /// </summary>
        private string _userId;
        /// <summary>
        /// Value indicating the authentication query failed and the operation is to be cancelled.
        /// </summary>
        private bool _cancel;

        #endregion

        /*--------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <remarks>
        /// This is the default constructor.
        /// </remarks>
        public CnrAuthenticationRequiredEventArgs()
            : base()
        {
            _password = string.Empty;
            _userId = string.Empty;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="userIdentityValue">
        /// A string indicating the user identity value.
        /// </param>
        public CnrAuthenticationRequiredEventArgs(string userIdentityValue)
            : base()
        {
            _password = string.Empty;
            _userId = userIdentityValue;
        }
        /// <summary>
        /// Class destructor.
        /// </summary>
        ~CnrAuthenticationRequiredEventArgs()
        {
            _password = null;
            _userId = null;
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets or sets a value indicating whether the authentication operation is to be 
        /// cancelled.
        /// </summary>
        /// <value>
        /// <b>true</b> to cancel the authentication operation; otherwise, <b>false</b>.
        /// </value>
        public bool Cancel
        {
            get { return _cancel; }
            set { _cancel = value; }
        }
        /// <summary>
        /// Gets or sets the user identity value.
        /// </summary>
        /// <value>
        /// A user ID or other identity value required for authentication.
        /// </value>
        public string UserIdentityValue
        {
            get { return _userId; }
            set { _userId = value; }
        }
        /// <summary>
        /// Gets or sets the user password value.
        /// </summary>
        /// <value>
        /// A user password or other security value required for authentication.
        /// </value>
        public string UserPasswordValue
        {
            get { return _password; }
            set { _password = value; }
        }
        #endregion
    }
}